FROM openjdk:8-jdk-alpine
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories
VOLUME /tmp
COPY Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone

ADD ./target/*.jar /app.jar

RUN echo $(date) > /image_built_at
ENV JAVA_OPTS="\
-server \
-Xmx1g \
-Xms256m \
-Xmn128m \
-XX:+UseParallelGC \
-XX:+UseParallelOldGC \
-XX:+UseAdaptiveSizePolicy \
-XX:+PrintGCDetails \
-XX:+PrintTenuringDistribution \
-XX:+PrintGCTimeStamps \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/app/www/webapp/logs/consumer/dump.log \
-Xloggc:/app/www/webapp/logs/consumer/gc.log \
-XX:+UseGCLogFileRotation \
-XX:NumberOfGCLogFiles=10 \
-XX:GCLogFileSize=100M \
-XX:+UnlockExperimentalVMOptions \
-XX:+UseCGroupMemoryLimitForHeap"

ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.jar --config.profile=${SPRING_PROFILES_ACTIVE}